package com.gongzhiyun.springboot3test.mapper.novel;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gongzhiyun.springboot3test.entity.novel.NovelCommentPraises;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface NovelCommentPraisesMapper extends BaseMapper<NovelCommentPraises> {
    //查询某评论的点赞量
    @Select("select count(*) from novel_comment_praises where comment_id=#{id}")
    Integer getCommentPraiseCount(Integer id);

    //查询某评论是否被当前用户点赞
    @Select("select  * from novel_comment_praises where user_id=#{userId} and comment_id=#{commentId}")
    NovelCommentPraises isPraised(Integer userId, Integer commentId);
}
